package com.ytf.test.ninth.filters;

interface Processor {
    public String name();

    Object process(Object obj);
}

class FilterAdapter implements Processor {
    Filter filter;

    public FilterAdapter(Filter filter) {
        this.filter = filter;
    }

    @Override
    public String name() {
        return filter.name();
    }

    @Override
    public Waveform process(Object input) {
        return filter.process((Waveform)input);
    }
}
/**
 * @author: YTF
 * @date: 2025/1/25 21:50
 * @version: 1.0
 * @description:
 */
public class FilterProcessor {

    public static void main(String[] args) {
        Waveform waveform = new Waveform();
        Apply.process(new FilterAdapter(new LowPass(1.0)),waveform);
        Apply.process(new FilterAdapter(new HighPass(2.0)),waveform);
        Apply.process(new FilterAdapter(new BandPass(3.0,4.0)),waveform);

        /**
         * OutPut:
         * Use Processor LowPass
         * Waveform{id=0}
         * Use Processor HighPass
         * Waveform{id=0}
         * Use Processor BandPass
         * Waveform{id=0}
         */
    }
}
